import { def } from '@vue/shared';
import { BasicFetchResult } from '../model/baseModel';
import { defHttp } from '@/utils/http/axios';
enum Api {
  SysDictTypeApi = '/sysDictType',
}
/**
 * 查询系统字典类型表分页
 * @author frank
 * @date 2022-09-01 10:42:20
 */
export const getSysDictTypePage = (params?: any) =>
  defHttp.get<BasicFetchResult<any>>({
    url: Api.SysDictTypeApi + '/page',
    params: { ...params, field: 'sort', order: 'ascend' },
  });
/**
 * 添加系统字典类型表
 * @author frank
 * @date 2022-09-01 10:42:20
 */
export const addSysDictType = (params?: any) =>
  defHttp.post({ url: Api.SysDictTypeApi + '/add', params });
/**
 * 修改系统字典类型表
 * @author frank
 * @date 2022-09-01 10:42:20
 */
export const editSysDictType = (params?: any) =>
  defHttp.post({ url: Api.SysDictTypeApi + '/edit', params });
/**
 * 删除系统字典类型表
 * @author frank
 * @date 2022-09-01 10:42:20
 */
export const deleteSysDictType = (params: string[]) =>
  defHttp.post({ url: Api.SysDictTypeApi + '/delete', params });
/**
 * 导出系统字典类型表
 * @author frank
 * @date 2022-09-01 10:42:20
 */
export const exportSysDictType = (id: string) =>
  defHttp.get(
    {
      responseType: 'blob',
      url: Api.SysDictTypeApi + '/export',
      params: { id },
    },
    { isReturnNativeResponse: true }
  );

export const getSysDictTypeTree = (params?: any) =>
  defHttp.get({ url: Api.SysDictTypeApi + '/tree', params });

export const getCacheKeys = () => defHttp.get({ url: '/common/cacheKey' });

export const getPermissions = () => defHttp.get({ url: '/common/permissions' });
